<?php
// +----------------------------------------------------------------------
// | 全局分类模型
// +----------------------------------------------------------------------
// | Author: 李乾坤 <261001642@qq.com>
// +----------------------------------------------------------------------
class CategoryModel extends CommonModel {
	protected $_validate	 =	 array(
		array('title','require','分类名称不能为空！'),
        array('title','checkTitle','分类名称已经存在！',0,'callback',1),
		array('module','require','参数缺失！'),
	);

	protected $_auto	 =	 array(
		array('status','1',self::MODEL_INSERT,'string'),
		array('create_time','time',self::MODEL_INSERT,'function'),
		array('update_time','time',self::MODEL_BOTH,'function'),
	);
	public function getCategory($module=null){
		$module= is_null($module) ? str_replace('Category', '', MODULE_NAME) : $module;
		$cateList=$this->where('module="'.$module.'" and status=1')->getField('id,title');
		return  $cateList;
	}
}
?>